package Nio;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.01.20.12.50
 */
public class Nio3 {
    public static void main(String[] args) {
       //文件写入
        try(var out= Files.newBufferedWriter(Paths.get(""))) {
           out.write("Hello 中文");
           out.flush();
       } catch (IOException e) {
           e.printStackTrace();
       }

        try(var out= Files.newBufferedWriter(Paths.get(""),StandardOpenOption.APPEND)) {
            out.write("Hello 中文");
            out.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
